<!-------- @HEADER
 !
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !
 !  Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
 !                  Copyright 2012 Sandia Corporation
 !
 ! Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
 ! the U.S. Government retains certain rights in this software.
 !
 ! Redistribution and use in source and binary forms, with or without
 ! modification, are permitted provided that the following conditions are
 ! met:
 !
 ! 1. Redistributions of source code must retain the above copyright
 ! notice, this list of conditions and the following disclaimer.
 !
 ! 2. Redistributions in binary form must reproduce the above copyright
 ! notice, this list of conditions and the following disclaimer in the
 ! documentation and/or other materials provided with the distribution.
 !
 ! 3. Neither the name of the Corporation nor the names of the
 ! contributors may be used to endorse or promote products derived from
 ! this software without specific prior written permission.
 !
 ! THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
 ! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 ! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 ! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
 ! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 ! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 ! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 ! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 ! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 ! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 ! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 !
 ! Questions? Contact Karen Devine	kddevin@sandia.gov
 !                    Erik Boman	egboman@sandia.gov
 !
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !
 ! @HEADER
-------> 
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="GENERATOR" content="Mozilla/4.7 [en] (X11; U; SunOS 5.7 sun4u) [Netscape]">
   <meta name="sandia.approved" content="SAND99-1376">
   <meta name="author" content="karen devine, kddevin@sandia.gov">
   <title> Zoltan Developer's Guide: Using Test Drivers: zdrive and zfdrive</title>

</head>
<body bgcolor="#FFFFFF">

<div ALIGN=right><b><i><a href="dev.html">Zoltan Developer's Guide</a>&nbsp; |&nbsp; <a href="dev_view.html">Next</a>&nbsp; |&nbsp; <a href="dev_refs.html">Previous</a></i></b></div>


<h2>
<a NAME="Zdrive"></a>Appendix: Using the Test Drivers: <i>zdrive</i>, <i>zCPPdrive</i> and <i>zfdrive</i></h2>

<h3>
<a NAME="Introduction"></a>Introduction</h3>
In order to facilitate development and testing of the Zoltan library, 
simple driver programs, <i>zdrive</i> (C), <i>zCPPdrive</i> (C++)
and <i>zfdrive</i> (Fortran90),
are included with the library
distribution. The concept behind the drivers is to read in mesh or graph
information from files, run Zoltan, and then output the new assignments
for each processor to another file. The test drivers <i>zdrive</i> 
and <i>zCPPdrive</i> read ExodusII/NemesisI
parallel FEM files, <a href="http://cs.sandia.gov/CRF/chac.html">Chaco</a>
input files, or <a href="https://math.nist.gov/MatrixMarket/">general 
Matrix-Market</a> files. 
Parallel NemesisI files can be created from ExodusII or Genesis
file using the NemesisI utilities <i>nem_slice</i> and <i>nem_spread</i>.
The Fortran90 program <i>zfdrive</i> reads only <a href="http://cs.sandia.gov/CRF/chac.html">Chaco</a> input files 
and  <a href="https://math.nist.gov/MatrixMarket/">general Matrix-Market</a>
 files.
<p>
Source code for <i>zdrive</i> is in 
the <i>driver</i> and <i>ch</i> directories of
the Zoltan distribution. 
The source code for <i>zCPPdrive</i> is also in <i>driver</i>, and uses some
of the same C source files (in <i>driver</i> and <i>ch</i>) that <i>zdrive</i> uses.
Source code for <i>zfdrive</i> is in the <i>fdriver</i> directory.  
<p>
The C and C++ test drivers are built automatically in the 
<a href="../ug_html/ug_usage.html#Autotools">Autotools</a> build system.
The F90 driver is built when the configure option "--enable-f90interface" is
provided.  The drivers are placed in <i>BUILD_DIR/src/driver</i> and
<i>BUILD_DIR/src/fdriver</i>, for build directory <i>BUILD_DIR</i>.
<p>
The C and C++ test drivers are built in the
<a href="../ug_html/ug_usage.html#CMake">CMake</a> build system when
option "-D Zoltan_ENABLE_Tests:BOOL=ON" is provided.  The F90 driver is
built when option "-D Zoltan_ENABLE_F90INTERFACE:BOOL=ON" is also provided.
The drivers are placed in <i>BUILD_DIR/packages/zoltan/src/driver</i> and
<i>BUILD_DIR/packages/zoltan/src/fdriver</i>; they are also copied to
<i>BUILD_DIR/packages/zoltan/test</i>.
<h3>
<a NAME="running zdrive"></a>Running the Test Drivers</h3>
The test drivers are run using an input command file. A fully commented example of
this file and the possible options can be found in <i><a href="zdrive.inp">zdrive.inp</a></i>.
The default name for the command file is <i>zdrive.inp</i>, and the drivers will
look for this file in the execution directory if an alternate name is not
given on the command line. If another filename is being used for the command
file, it should be specified as the first argument on the command line.
(Note:  <i>zfdrive</i> cannot read a command line argument; its input file
must be named <i>zdrive.inp</i>.)
<p>
For an example of a simple input file, see the <a href="#zdrive input">figure</a>
below. In this problem, the method being used for dynamic load balancing
is <a href="dev_rcb.html#RCB">RCB</a>.&nbsp; Input data is read from <a href="http://cs.sandia.gov/CRF/chac.html">Chaco</a>
input files<i> simple.graph</i> and <i>simple.coords</i>.&nbsp; Zoltan's
<a href="../ug_html/ug_param.html#Debug Levels in Zoltan">DEBUG_LEVEL</a> parameter
is set to 3; default values of all other parameters are used.
(Note:  <i>zfdrive</i> can read only a simplified version of the input file.
See the <i>zfdrive</i> notes in <i><a href="zdrive.inp">zdrive.inp</a></i> for more details.)
<br>&nbsp;
<center><table BORDER=2 COLS=1 WIDTH="90%" NOSAVE >
<tr VALIGN=TOP>
<td><a NAME="zdrive input"></a>
<tt>
Decomposition method&nbsp; = rcb
<br>Zoltan Parameters&nbsp;&nbsp;&nbsp;&nbsp; = Debug_Level=3
<br>File Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= Chaco
<br>File Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= simple
<br>Parallel Disk Info&nbsp;&nbsp;&nbsp; = number=0
</tt>
</td>
</tr>

<caption ALIGN=BOTTOM><i><font size=-1>Example zdrive.inp file</font></i></caption>
</table></center>

<p>The <i>zdrive</i> programs creates ascii files named 
"<i>file_name</i>.out.<i>p</i>.<i>n</i>", where <i>file_name</i>
is the file name specified in <i>zdrive.inp</i>, <i>p</i> is the number
of processors on which <i>zdrive</i> was run, and <i>n</i>=0,1,...,<i>p</i>-1 is
the processor by which the file was created.  (For <i>zfdrive</i>, the
files are named "<i>file_name</i>.fout.<i>p</i>.<i>n</i>".)
These files are in the same directory where the input graph
file was located for that processor. Each file contains a list of global
ids for the elements that are assigned to that processor after running Zoltan.
The input decomposition can also be written in this format to files 
"<i>file_name</i>.in.<i>p</i>.<i>n</i>";
see "zdrive debug level" in <i><a href="zdrive.inp">zdrive.inp</a></i> for more details.
<p>
Decompositions for 2D problems can be written to files that can be plotted 
by <a href="https://www.gnuplot.org/">gnuplot</a>.  See "gnuplot output" in  <i><a href="zdrive.inp">zdrive.inp</a></i>
for more information.  Decompositions for 3D problems can be viewed after the
test driver has finished by running the graphical tools <I>vtk_view</I> or
<I>vtk_write</I> described <a href="dev_view.html">next</a>.
<h3>
<a NAME="adding algorithms"></a>Adding New Algorithms</h3>
The driver has been set up in such a way that testing new algorithms that
have been added to Zoltan is relatively simple. The method that is in the
input file is passed directly to Zoltan. Thus, this string must be the
same string that the parameter <a href="../ug_html/ug_alg.html#LB_METHOD"><i>LB_METHOD</i></a> is expecting.
<h3>
<hr WIDTH="100%">
<br>[<a href="dev.html">Table of Contents</a>&nbsp; |&nbsp; <a href="dev_view.html">Next:&nbsp;
Visualizing Geometric Partitions</a>&nbsp; |&nbsp; <a href="dev_refs.html">Previous:&nbsp;
References</a>&nbsp; |&nbsp; <a href="https://www.sandia.gov/general/privacy-security/index.html">Privacy and Security</a>]
</body>
</html
